package com.byted.camp.todolist.operation.db.entity;

public enum Priority {
    HIGH(2),MEDIUM(1),DEFAULT(0);

    public final int intValue;

    Priority(int intValue) {
        this.intValue = intValue;
    }

    public static Priority from(int intValue) {
        for (Priority priority:Priority.values()) {
            if (priority.intValue == intValue) {
                return priority;
            }
        }
        return DEFAULT; // default
    }

    public static Priority from(String text){
        switch (text){
            case "HIGH":    return HIGH;
            case "MEDIUM":  return MEDIUM;
            case "LOW":     return DEFAULT;
            default:    return DEFAULT;
        }
    }
}
